<template>
	<view class="securityStaffDetail">
		<view class="process-cont">
			<view class="polling" style="margin-top: 25px;margin-bottom: 15px;">
				<view class="polling_name"> {{userObj.workflow_name}}</view>
			</view>
			<view style="float: right;margin-top: -75px;margin-right: 30rpx;">
				<view class="notice-typePuTong">
					{{userObj.workflow_classify_name}}
				</view>
			</view>
			
			<view>
				<view style="background: #FFFFFF;border-radius: 20rpx; box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.15);">
					<view style="text-align: center;">
						<view style="font-weight: bold;padding:20rpx 20rpx 40rpx;align-items: center;justify-content: center;">
							<view class="polling_in">
								<view style="color:#999">创建人：</view>
								<view>{{userObj.create_person}}</view>
								
								<view style="color:#999;margin-left: 20px;">创建时间：</view>
								<view>{{userObj.create_time.split(' ')[0]}}</view>
							</view>
							<view class="polling_in">
								<view style="color:#999">适用单位：</view>
								<view>
									<span v-if='userObj.workflow_post_name'>{{userObj.workflow_post_name}}该岗位下所有人员</span>
									<span v-else-if="userObj.workflow_depa_name">{{userObj.workflow_depa_name}}该部门下所有人员</span>
									<span v-else-if="userObj.workflow_pro_name">{{userObj.workflow_pro_name}}该项目下所有人员</span>
								</view>
							</view>
							<view class="polling_in">
								<view style="color:#999">工作地点：</view>
								<view>{{userObj.workflow_working_position}}</view>
							</view>
						</view>
					</view>
				</view>
			</view>
			
			<view v-for="(item, index) in workflowStep" :key="index" style="margin-top: 10px;">
				<view class="process-content">
					<view class="process-left">
						<view class="num">{{ index + 1 }}</view>
						<view class="line" v-if="workflowStep.length-1!=index"></view>
					</view>
					<view class="process-right">
						<view style="padding-bottom: 5px;">内容：{{ item.textarea }}</view>
						<view style="word-wrap:break-word" >
							<image  v-for="(item2,index2) in item.imgArr"  @click="preview(item2.url)"
							style="width: 85px;height: 85px;margin-left: 10px;" :src="item2.url" mode=""></image>
							
						</view>
					</view>
				</view>
				
			</view>
			
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				userObj:{},
				workflowStep:[],
				index:0,
			};
		},
		onLoad(options) {
			const encodedItem = encodeURIComponent(options.item);
			const item = JSON.parse(decodeURIComponent(encodedItem));
			this.userObj = item
			this.workflowStep = JSON.parse(this.userObj.workflow_step);
			console.log(this.workflowStep)
		},
		watch: {
		    dateArr(val) {
		      this.$set(this.userObj, "workflow_state", val[0]);
		      this.$set(this.userObj, "workflow_state_new", val[1]);
		    },
		},
		methods:{
			//跳转
			navTo(url) {
				this.navigateTo({
					url: url
				});
			},
			show(){
				uni.showModal({
				    title: '提示',
				    content: '这是一个模态弹窗',
				    success: function (res) {
				        if (res.confirm) {
				            console.log('用户点击确定');
				        } else if (res.cancel) {
				            console.log('用户点击取消');
				        }
				    }
				});
			},
			// 图片预览
			preview(val) {
				uni.previewImage({
					urls: [val],
					current: 0,
					longPressActions: {
						success: function(data) {
							console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
						},
						fail: function(err) {
							console.log(err.errMsg);
						}
					}
				});
			},
		}
	}
</script>

<style lang="scss">
	.securityStaffDetail{
		.process-cont{
			padding: 30rpx 36rpx;
			.video-info{
				background:#FFFFFF;
				padding:28rpx;
				box-shadow: 0px 2rpx 10rpx 0rpx rgba(153, 153, 153, 0.1);
				border-radius: 12rpx;
				text-align: center;
			}
			.title{
				font-size: 32rpx;
				font-family: PingFangSC-Medium, PingFang SC;
				font-weight: 500;
				color: #333333;
				padding-bottom: 30rpx;
				display: flex;
				justify-content: space-between;
				align-items: center;
				.title-edit{
					display: flex;
					align-items: center;
					color: #578EF0;
					.edit-icon{
						width: 28rpx;
						height: 27rpx;
						margin-left: 12rpx;
					}
				}
			}
			.process-content{
				display: flex;
				justify-content: space-between;
				margin-bottom: 30rpx;
				
				.process-left{
					.num{
						width: 50rpx;
						height: 50rpx;
						background: #427705;
						border-radius: 30rpx;
						text-align: center;
						line-height: 50rpx;
						color: #FFFFFF;
					}
					.line{
						margin:10rpx auto;
						height: calc(100% - 52rpx);
						width: 2rpx;
						background: #427705;
					}
					
				}
				.process-right{
					width: 620rpx;
					padding:28rpx;
					font-size: 28rpx;
					font-family: PingFangSC-Regular, PingFang SC;
					font-weight: 400;
					color: #333333;
					line-height: 42rpx;
					box-shadow: 0px 2rpx 10rpx 0rpx rgba(153, 153, 153, 0.1);
					border-radius: 12rpx;
					background: #e7e7e7;
					.process-img{
						max-width: 267px;
						margin:20rpx auto;
					}
					.edit-text{
						text-align: right;
						font-size: 28rpx;
						font-family: PingFangSC-Regular, PingFang SC;
						font-weight: 400;
						color: #578EF0;
					}
				}
			}
		}
		.footer-btn{
			display: flex;
			justify-content: space-between;
			padding-bottom: 30rpx;
		}
	}
	.line_radio {
		width: 20rpx;
		height: 20rpx;
		border-radius: 50%;
		position: relative;
		left: 50%;
		transform: translateX(-50%);
		top: 0;
	}
	.line_for {
		width: 4rpx;
		height: 100%;
		margin: 0 20rpx 10rpx;
		background-color:#559DFF;
	}
	.polling_in{
		display: flex;
		margin-top: 20rpx;
		// color: #999999;
	}
	.polling{
		display: flex;
		font-size: 18px;
		text-align: center;
	}
	.polling_name{
		// color: #000000;
		font-weight: bold;
		width: 100%;
	}
	.notice-typePuTong {
		background: linear-gradient(90deg, #00aa00 0%, #55aa00 100%);
		border-radius: 20rpx 0;
		text-align: center;
		color: #fff;
		padding: 10rpx 20rpx;
	}
</style>
